package com.cxcs.cxcsojbackenduserservice.controller.inner;

import com.cxcs.cxcsojbackendmodel.entity.User;
import com.cxcs.cxcsojbackendmodel.vo.UserVO;
import com.cxcs.cxcsojbackendserviceclient.service.UserFeignClient;
import com.cxcs.cxcsojbackenduserservice.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * 【远程接口实现类】用户服务
 *      该服务仅供内部调用
 *
 * @Author: CxCS
 * @Version: 1.0
 * @Date: 2024-08
 */
@RestController
@RequestMapping("/inner")
public class UserInnerController implements UserFeignClient {

    @Resource
    private UserService userService;

    @Override
    @GetMapping("/get/id")
    public User getById(@RequestParam("userId") long userId) {
        return userService.getById(userId);
    }

    @Override
    @GetMapping("/get/ids")
    public List<User> listByIds(@RequestParam("idList") Collection<Long> ids) {
        return userService.listByIds(ids);
    }


    @Override
    @GetMapping("/vo/get/id")
    public UserVO getUserVOById(@RequestParam("userId") Long userId) {
        return userService.getUserVOById(userId);
    }
}
